package com.example.springbeaninit;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ImportResource;

//@ImportResource({"classpath:applicationContext.xml", "classpath:applicationContext2.xml"})
@SpringBootApplication
public class SpringbeaninitApplication {

    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(SpringbeaninitApplication.class);
        // Spring Boot版本>=2.1.0时，默认不允许bean覆盖。我们为了研究bean覆盖机制，将它改成允许覆盖。
//        springApplication.setAllowBeanDefinitionOverriding(true);
        ApplicationContext context = springApplication.run(args);
        Object myBean = context.getBean("demoService");
//        Object myBean = context.getBean("myBean");
        System.out.println(myBean.getClass().getName());


    }

}
